<template>
	<view class="home">
		<view class="activebg">
			<ty-swiper-home :list="carousel" height='360' radius='50'></ty-swiper-home>
		</view>
		<view class="searchbg margin-tb-40">
			<text class="tyIcon-search text-66"></text>
			<input type="text" placeholder="搜索游戏名称" v-model="title" class="flex-one margin-left-20 text-32"
				confirm-type='search' @confirm="getSearch" />
		</view>
		<view class="margin-bottom-40 gamebg position-relative" v-for="(item,index) in list" :key="index">
			<image :src="item.image_url" mode="" class="gameimg"></image>
			<view class="gamecont padding-lr-25">
				<view class="padding-top-30 text-32 text-bold text-cut-one">{{item.title}}</view>
				<view class="padding-top-10 text-24 text-99 text-cut-one">{{item.summary}}</view>
				<view class="flex align-center justify-around margin-top-25">
					<view class="wantbtn" @click="go('/pages/board/make')">想玩</view>
					<view class="tybtn"
						@click="go('/pages/game/experience?id='+item.id+'&image_url='+item.image_url+'&title='+item.title+'&summary='+item.summary+'&rating='+item.rating)">
						已体验</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				carousel: [{
					image: '/static/board/member.png'
				}, {
					image: '/static/board/member.png'
				}],
				title: "",
				list: []
			}
		},
		onReady() {
			this.rq.getData('common/banner', {
				type: 2
			}).then(res => {
				if (res.code == 1) {
					this.carousel = res.data
				}
			})
		},
		onShow() {
			this.loadList(1)
		},
		methods: {
			loadList(isFirstPage) {
				var that = this
				that.rq.getList('game/game_exp_list', {
					title: this.title,
					shop_id: uni.getStorageSync('store_id'),
				}, {
					that: that,
					first_page: isFirstPage
				})
			},
			getSearch() {
				this.loadList(1)
			}
		},
		onReachBottom() {
			this.loadList(0)
		}
	}
</script>

<style>
	.home {
		width: 100%;
		min-height: 100vh;
		background: #fff;
		padding: 40rpx 30rpx;
	}

	.searchbg {
		width: 100%;
		height: 80rpx;
		background: #F3F3F3;
		border-radius: 1998rpx 1998rpx 1998rpx 1998rpx;
		display: flex;
		align-items: center;
		padding: 0 20rpx;
	}

	.gamebg {
		width: 100%;
		height: 584rpx;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		padding: 20rpx;
	}

	.gameimg {
		width: 100%;
		height: 100%;
		border-radius: 40rpx;
		position: absolute;
		top: 0;
		right: 0;
		left: 0;
		bottom: 0;
	}

	.gamecont {
		width: 100%;
		height: 224rpx;
		background: #FFFFFF;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		position: relative;
		top: 320rpx;
		/* left: 20rpx; */
		/* right: 20rpx; */
	}

	.wantbtn {
		width: 232rpx;
		height: 72rpx;
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		border: 2rpx solid #101010;
		font-weight: bold;
		font-size: 28rpx;
		color: #101010;
		line-height: 72rpx;
		text-align: center;
	}

	.tybtn {
		width: 232rpx;
		height: 72rpx;
		background: #101010;
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		font-weight: bold;
		font-size: 28rpx;
		color: #FFFFFF;
		line-height: 72rpx;
		text-align: center;
	}
</style>